{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--<link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
    
    <link rel="stylesheet" href="bootstrap-3.4.1-dist/css/bootstrap.min.css">
    <script src="bootstrap-3.4.1-dist/js/jquery3.6.4.min.js"></script>
    <script src="bootstrap-3.4.1-dist/js/bootstrap.min.js"></script>
    -->
    <link rel="stylesheet" href="{% static 'bootstrap-3.4.1-dist/css/bootstrap.min.css' %}">
    <script src="{% static 'bootstrap-3.4.1-dist/js/jquery3.6.4.min.js' %}"></script>
    <script src="{% static 'bootstrap-3.4.1-dist/js/bootstrap.min.js' %}"></script>
    <style>
        .left-menu{
            background: #dff0d8;
        }
    </style>
</head>
<body>
<nav class="navbar navbar-inverse">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">生产面板</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="active"><a href="#">线别 <span class="sr-only">(current)</span></a></li>
                <li><a href="#">客户</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">更多操作 <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">Action</a></li>
                        <li><a href="#">Another action</a></li>
                        <li><a href="#">Something else here</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">Separated link</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">One more separated link</a></li>
                    </ul>
                </li>
            </ul>
            <form class="navbar-form navbar-left">
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="Search">
                </div>
                <button type="submit" class="btn btn-default">Submit</button>

            </form>
            <ul class="nav navbar-nav navbar-right">

                {% if request.user.is_authenticated %}
                    <li><a href="#">{{ request.user.username }}</a></li>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                           aria-expanded="false">更多操作 <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="#" data-toggle="modal" data-target=".bs-example-modal-lg">修改密码</a></li>
                            <li><a href="/set/avatar/">修改头像</a></li>
                            <li><a href="#">后台管理</a></li>
                            <li role="separator" class="divider"></li>
                            <li><a href="#">退出登录</a></li>
                        </ul>
                        <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog"
                             aria-labelledby="myLargeModalLabel">
                            <div class="modal-dialog modal-lg" role="document">
                                <div class="modal-content">

                                    <h1 class="text-center">修改密码</h1>
                                    <div class="row">
                                        <div class="col-md-6 col-md-offset-2">
                                            <div class="form-group">
                                                <label for="">用户名</label>
                                                <input type="text" disabled value="{{ request.user.username }}"
                                                       class="form-control">
                                            </div>
                                            <div class="form-group">
                                                <label for="">原密码</label>
                                                <input type="password" id="id_old_password" name="old_name"
                                                       class="form-control">
                                            </div>
                                            <div class="form-group">
                                                <label for="">新密码</label>
                                                <input type="password" id="id_new_password" class="form-control">
                                            </div>

                                            <div class="form-group">
                                                <label for="">确认密码</label>
                                                <input type="password" id="id_confirm_password" class="form-control">


                                            </div>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-default" data-dismiss="modal">
                                                    取消
                                                </button>
                                                <button class="btn btn-primary" id="id_edit">修改</button>

                                                <br>
                                                <br>
                                            </div>
                                            <span style="color: red" id="password_error"></span>
                                        </div>


                                    </div>
                                </div>
                            </div>
                        </div>
                    </li>

                {% else %}
                    <li><a href="{% url 'login' %}">登录</a></li>
                    <li><a href="{% url 'reg' %}">注册</a></li>
                {% endif %}
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->

</nav>
<div>
    <div class="container-fluid">
        <div class="row ">
            <div class="col-md-2" style="background:#dff0d8 ">
                <ul class="nav nav-sidebar ">
                    <li class="active"><a href="">订单相关 <span class="sr-only">(current)</span></a>
                    </li>
                    <li><a href="{% url 'order_list' %}">工单列表</a></li>
                    <li><a href="{% url 'plan_list' %}">计划列表</a></li>
                    <li><a href="#">日报列表</a></li>
                    <li><a href="#">制造表</a></li>
                </ul>
            </div>
            <div class="col-md-10">
                <h3>制造二课产线数量面板</h3>
                <table class="table-hover table">
                    <thead>
                    <tr>
                        <td>#</td>
                        <td>序号</td>
                        <td>班次</td>
                        <td>线别</td>
                        <td>计划数量</td>
                        <td>完成数量</td>
                        <td>完成比例</td>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td><input type="checkbox"></td>
                        <td>1</td>
                        <td>白班</td>
                        <td>F线</td>
                        <td>3000</td>
                        <td>2000</td>
                        <td>
                            <div class="progress">
                                <div class="progress-bar" role="progressbar" aria-valuenow="66.67" aria-valuemin="0"
                                     aria-valuemax="100" style="width: 66.67%;">
                                    66.67%
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td><input type="checkbox"></td>
                        <td>2</td>
                        <td>白班</td>
                        <td>C线</td>
                        <td>4500</td>
                        <td>4000</td>
                        <td>
                            <div class="progress">
                                <div class="progress-bar" role="progressbar" aria-valuenow="88.88" aria-valuemin="0"
                                     aria-valuemax="100" style="width: 88.88%;">
                                    88.88%
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td><input type="checkbox"></td>
                        <td>2</td>
                        <td>白班</td>
                        <td>M线</td>
                        <td>4000</td>
                        <td>4000</td>
                        <td>
                            <div class="progress">
                                <div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0"
                                     aria-valuemax="100" style="width: 100%;">
                                    100%
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td><input type="checkbox"></td>
                        <td>2</td>
                        <td>夜班</td>
                        <td>M线</td>
                        <td>4000</td>
                        <td>4000</td>
                        <td>
                            <div class="progress">
                                <div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0"
                                     aria-valuemax="100" style="width: 100%;">
                                    100%
                                </div>
                            </div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>


    </div>
</div>
</div>

<footer class="site-footer">
          <div class="text-center">
              上海赛路客电子有限公司 <a href="http://www.celco.cn/" target="_blank" ></a><a href="#" ></a>
              <a href="#" class="go-top">
                  <i class="icon-angle-up"></i>
              </a>
          </div>
      </footer>


<script>
        $("#id_edit").click(function () {
            $.ajax({
                url: '/set_password/',
                type: 'post',
                data: {
                    "old_password": $("#id_old_password").val(),
                    "new_password": $("#id_new_password").val(),
                    "confirm_password": $("#id_confirm_password").val(),
                    "csrfmiddlewaretoken": '{{ csrf_token }}'
                },
                success: function (args) {
                    if (args.code == 200) {
                        window.location.reload()
                    } else {
                        $("#password_error").text(args.errmsg)
                    }
                }

            })
        })


    </script>

</body>
</html>